<?php
/*
	我的下线
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
cfc('core')->checklogin();
set_html('title','门店客户');
if($_RQ['op']=='main'){
	$return['setting']=$this->plugin_setting('page');
	set_html('tabs','门店客户');
	$agent_num=$this->count('member',array('uniacid'=>$_SESSION['uniacid'],'storemid'=>$_SESSION['uid']),array('mid'),'mid');
	$return['agent_num']=$agent_num;
	$return['member']=$this->get('member',array('mid'=>$_SESSION['uid']));
	$return['params']=array('page'=>1,'level'=>1);
	$return['psize']=20;
	$return['list']=array();
	exi($return);
}
if($_RQ['op']=='list'){
	$params=array('uniacid'=>$_SESSION['uniacid'],'storemid'=>$_SESSION['uid']);
	$psize=10;
	$pindex=intval($_RQ['page'])?:1;
	$parameter=array(
		'params'=>$params,
		'limit'=>array($pindex,$psize),
	);
	$list=$this->get_list('member',$parameter);
	if(!$list){
		exi('none');
	}
	foreach($list as &$item){
		$item['member']=cfc('core')->member_show($item['mid']);
		$item['ordercount']=$this->count('order',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$item['mid']));
		$item['moneycount']=$this->getsum('order',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$item['mid']),'order_price');
	}
	exi($list);
}
?>